<template>
  <div class="login-container">
    <div class="left-side">
      <img alt="风景图" src="https://bing.img.run/rand_uhd.php">
    </div>
    <div class="right-side">
      <h2>商家管理系统</h2>
      <el-form v-model="loginForm" label-width="80px">
        <el-form-item label="账号">
          <el-input v-model="loginForm.username" placeholder="请输入账号"></el-input>
        </el-form-item>
        <el-form-item label="密码">
          <el-input v-model="loginForm.password" placeholder="请输入密码" type="password"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleLogin">登录</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script setup>
import {reactive} from 'vue';

const loginForm = reactive({
  username: '',
  password: '',
});

const handleLogin = () => {
  // 处理登录逻辑
  if (loginForm.username == '' || loginForm.password == '') {
    alert('账号或密码不能为空！');
  }
};
</script>

<style scoped>
.login-container {
  display: flex;
  height: 100vh;
}

.left-side {
  width: 50%;
  background-color: #409EFF;
}

.left-side img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.right-side {
  width: 50%;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.el-form {
  width: 300px;
}
</style>